<?php

function ipv4network($addr, $mask)
{
        return ( long2ip((ip2long($addr)) & (ip2long($mask))) );
}

function ipv4broadcast($addr, $mask)
{
        return ( long2ip(ip2long(ipv4network($addr,$mask)) | (~(ip2long($mask)))) );
}

//echo ipv4network('192.168.0.12', '255.255.255.248')."n";
//echo ipv4broadcast ('192.168.0.12', '255.255.255.248');
?>
